<?php

class Controller_Game extends Controller_Abstract
{
	
	function actionInit()
	{
		$result = array();
		$user = $this->_app->currentUser();
		if (empty($user) && isset($_SESSION['PLAYED']))
		{
			$result['uid'] = '0';
			$result['credit'] = 0;
			$result['cash'] = 1.00;
			$result['jackpot'] = $this->_site['jackpot'];
		}
		else if (empty($user))
		{
			$result['uid'] = '0';
			$result['credit'] = 1;
			$result['cash'] = 0.00;
			$result['jackpot'] = $this->_site['jackpot'];
		}
		else
		{
			$usermodel = new User();
			$userinfo = $usermodel->getUserById($user['id']);
			if ($userinfo == false)
			{
				$result['error'] = 1;
				$result['code'] = 10002;
				$result['message'] = Util::getMessage(10002);
			}
			else
			{
				$result['uid'] = $userinfo['id'];
				$result['credit'] = $userinfo['credit'];
				$result['cash'] = $userinfo['balance'];
				$result['jackpot'] = $this->_site['jackpot'];
			}
		}
		echo json_encode($result);
		exit();
	}
	
	function actionWheel()
	{
		$uid = $this->_context->uid;
		$result = array();
		$game = new Game();
		$cu = $this->_app->currentUser();
		$moneysign = strtolower($this->_site['locale']) == 'uk' ? '£' : '$';
		if ($uid == '0')
		{
			$result['result'] = DOLLAR_1;
			$result['jackpot'] = $this->_site['jackpot'];
			$result['credit'] = 0;
			$result['cash'] = 1;
			$_SESSION['PLAYED'] = true;
		}
		else if (empty($uid))
		{
			$result['error'] = 1;
			$result['code'] = 10003;
			$result['message'] = Util::getMessage(10003);
		}
		else if ($cu['id'] != $uid)
		{
			$result['error'] = 1;
			$result['code'] = 10004;
			$result['message'] = Util::getMessage(10004);
		}
		else
		{
			$won = 0;
			$credit = 0;
			
			$usermodel = new User();
			$userinfo = $usermodel->getUserById($uid);
			if ($userinfo == false)
			{
				$result['error'] = 1;
				$result['code'] = 10002;
				$result['message'] = Util::getMessage(10002);
			}
			else if ($userinfo['credit'] <= 0)
			{
				$result['error'] = 1;
				$result['code'] = 10005;
				$result['message'] = Util::getMessage(10005);
			}
			else if ($userinfo['played'] < 10)
			{
				if ($userinfo['won'] > 10)
				{
					$r = LOSE;
				}
				else
				{
					$pt = array();
					$pt[] = DOLLAR_3;
					$pt[] = DOLLAR_2;
					$pt[] = DOLLAR_2;
					$pt[] = DOLLAR_1;
					$pt[] = CENT_50;
					$pt[] = CENT_50;
					$pt[] = CENT_50;
					$pt[] = CENT_25;
					$pt[] = CENT_15;
					$pt[] = CENT_10;
					$pt[] = LOSE;
					shuffle($pt);
					$r = $pt[0];
				}
				$activity = new Activity();
				if ($r == LOSE)
				{
					$usermodel->afterWheelPlay($uid, 0);
				}
				else if ($r == CENT_10)
				{
					$usermodel->afterWheelPlay($uid, 0.1);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'0.1', $this->_site['id']);
					$won = 0.1;
				}
				else if ($r == CENT_15)
				{
					$usermodel->afterWheelPlay($uid, 0.15);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'0.15', $this->_site['id']);
					$won = 0.15;
				}
				else if ($r == CENT_25)
				{
					$usermodel->afterWheelPlay($uid, 0.25);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'0.25', $this->_site['id']);
					$won = 0.25;
				}
				else if ($r == CENT_50)
				{
					$usermodel->afterWheelPlay($uid, 0.5);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'0.5', $this->_site['id']);
					$won = 0.5;
				}
				else if ($r == DOLLAR_1)
				{
					$usermodel->afterWheelPlay($uid, 1);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'1', $this->_site['id']);
					$won = 1;
				}
				else if ($r == DOLLAR_2)
				{
					$usermodel->afterWheelPlay($uid, 2);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'2', $this->_site['id']);
					$won = 2;
				}
				else if ($r == DOLLAR_3)
				{
					$usermodel->afterWheelPlay($uid, 3);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'3', $this->_site['id']);
					$won = 3;
				}
				$userinfo = $usermodel->getUserById($uid);
				$result['result'] = $r;
				$result['credit'] = $userinfo['credit'];
				$result['cash'] = $userinfo['balance'];
				$result['jackpot'] = $this->_site['jackpot'];
				
				//TODO:  wheel game record
				$record = new Record($uid);
				$record->addPlayRecording($won, $credit, 1, $userinfo['credit'], $userinfo['balance']);
			}
			else
			{
				$usermodel = new User();
				$u = $usermodel->getUserById($uid);
				$r = $game->wheelPlay(BASIC_PAYTABLE, $u['played']);
				$activity = new Activity();
				if ($r == LOSE)
				{
					$usermodel->afterWheelPlay($uid, 0);
				}
				else if ($r == CREDIT_1)
				{
					$usermodel->afterWheelPlay($uid, 0, 1);
				}
				else if ($r == CREDIT_2)
				{
					$usermodel->afterWheelPlay($uid, 0, 2);
					$credit = 2;
				}
				else if ($r == CENT_10)
				{
					$usermodel->afterWheelPlay($uid, 0.1);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'0.1', $this->_site['id']);
					$won = 0.1;
				}
				else if ($r == CENT_15)
				{
					$usermodel->afterWheelPlay($uid, 0.15);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'0.15', $this->_site['id']);
					$won = 0.15;
				}
				else if ($r == CENT_25)
				{
					$usermodel->afterWheelPlay($uid, 0.25);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'0.25', $this->_site['id']);
					$won = 0.25;
				}
				else if ($r == CENT_50)
				{
					$usermodel->afterWheelPlay($uid, 0.5);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'0.5', $this->_site['id']);
					$won = 0.5;
				}
				else if ($r == DOLLAR_1)
				{
					$usermodel->afterWheelPlay($uid, 1);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'1', $this->_site['id']);
					$won = 1;
				}
				else if ($r == DOLLAR_2)
				{
					$usermodel->afterWheelPlay($uid, 2);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'2', $this->_site['id']);
					$won = 2;
				}
				else if ($r == DOLLAR_3)
				{
					$usermodel->afterWheelPlay($uid, 3);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'3', $this->_site['id']);
					$won = 3;
				}
				else if ($r == DOLLAR_5)
				{
					$usermodel->afterWheelPlay($uid, 5);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'5', $this->_site['id']);
					$won = 5;
				}
				else if ($r == DOLLAR_10)
				{
					$usermodel->afterWheelPlay($uid, 10);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'10', $this->_site['id']);
					$won = 10;
				}
				else if ($r == DOLLAR_20)
				{
					$usermodel->afterWheelPlay($uid, 20);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'20', $this->_site['id']);
					$won = 20;
				}
				else if ($r == DOLLAR_50)
				{
					$usermodel->afterWheelPlay($uid, 50);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'50', $this->_site['id']);
					$won = 50;
				}
				else if ($r == DOLLAR_100)
				{
					$usermodel->afterWheelPlay($uid, 100);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'100', $this->_site['id']);
					$won = 100;
				}
				else if ($r == DOLLAR_150)
				{
					$usermodel->afterWheelPlay($uid, 150);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'150', $this->_site['id']);
					$won = 150;
				}
				else if ($r == DOLLAR_200)
				{
					$usermodel->afterWheelPlay($uid, 200);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'200', $this->_site['id']);
					$won = 200;
				}
				else if ($r == DOLLAR_250)
				{
					$usermodel->afterWheelPlay($uid, 250);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'250', $this->_site['id']);
					$won = 250;
				}
				else if ($r == DOLLAR_300)
				{
					$usermodel->afterWheelPlay($uid, 300);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.'300', $this->_site['id']);
					$won = 300;
				}
				else if ($r == JACKPOT)
				{
					$usermodel->afterWheelPlay($uid, $this->_site['jackpot']);
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won Jackpot('.$moneysign.$this->_site['jackpot'].')', $this->_site['id']);
					$won = $this->_site['jackpot'];
				}
				else
				{
				}
				$userinfo = $usermodel->getUserById($uid);
				$result['result'] = $r;
				$result['credit'] = $userinfo['credit'];
				$result['cash'] = $userinfo['balance'];
				if ($r == JACKPOT)
				{
					$result['jackpot'] = 0;
					$site = new Site();
					$site->wonJackpot($this->_site['id']);
				}
				else
				{
					$result['jackpot'] = $this->_site['jackpot'];
				}
				//TODO:  wheel game record
				$record = new Record($uid);
				$record->addPlayRecording($won, $credit, 1, $userinfo['credit'], $userinfo['balance']);
			}
			
		}
		
		echo json_encode($result);
		exit;
	}
	function actionSlot()
	{
		$uid = $this->_context->uid;
		$line = $this->_context->line;
		$bet = $this->_context->bet;
		$result = array();
		$cu = $this->_app->currentUser();
		$moneysign = strtolower($this->_site['locale']) == 'uk' ? '£' : '$';
		if ($line > 5 || $line < 1)
		{
			$result['error'] = 1;
			$result['code'] = 10006;
			$result['message'] = Util::getMessage(10006);
		}
		else if ($bet < 1 || $bet > 3)
		{
			$result['error'] = 1;
			$result['code'] = 10007;
			$result['message'] = Util::getMessage(10007);
		}
		else if ($uid == 0)
		{
			$result['s11'] = rand(SLOT_BANANA,SLOT_BELL);
			$result['s12'] = rand(SLOT_BANANA,SLOT_BELL);
			$result['s13'] = rand(SLOT_BANANA,SLOT_BELL);
			$result['s21'] = SLOT_LIME;
			$result['s22'] = SLOT_LIME;
			$result['s23'] = SLOT_LIME;
			$result['s31'] = rand(SLOT_BANANA,SLOT_BELL);
			$result['s32'] = rand(SLOT_BANANA,SLOT_BELL);
			$result['s33'] = rand(SLOT_BANANA,SLOT_BELL);
			$result['jackpot'] = $this->_site['jackpot'];
			$result['credit'] = 0;
			$result['cash'] = 1;
			$result['won_cash'] = 1;
			$result['won_credit'] = 0;
			$result['l1'] = true;
			$result['l2'] = false;
			$result['l3'] = false;
			$result['l4'] = false;
			$result['l5'] = false;
			$_SESSION['PLAYED'] = true;
		}
		else if (empty($uid))
		{
			$result['error'] = 1;
			$result['code'] = 10003;
			$result['message'] = Util::getMessage(10003);
		}
		else if ($cu['id'] != $uid)
		{
			$result['error'] = 1;
			$result['code'] = 10004;
			$result['message'] = Util::getMessage(10004);
		}
		else
		{			
			$usermodel = new User();
			$userinfo = $usermodel->getUserById($uid);
			if ($userinfo == false)
			{
				$result['error'] = 1;
				$result['code'] = 10002;
				$result['message'] = Util::getMessage(10002);
			}
			else if ($userinfo['credit'] < $bet*$line)
			{
				$result['error'] = 1;
				$result['code'] = 10005;
				$result['message'] = Util::getMessage(10005);
			}
			else
			{			
				$game = new Game();
				$usermodel = new User();
				$offers = $usermodel->getOffersByUserId($uid);
				if ($userinfo['played'] < 50 && $userinfo['won'] < 10)
				{
					$r = $game->slotBigPlay($bet, $line, $userinfo['won']);
				}
				else
				{
					$r = $game->slotPlay($bet, $line, $this->_site['jackpot'], BASIC_PAYTABLE, $offers);
				}
				$usermodel->afterSlotPlay($uid, $bet*$line, $r['won'], $r['credit']);
				$userinfo = $usermodel->getUserById($uid);
				$result['credit'] = $userinfo['credit'];
				$result['cash'] = $userinfo['balance'];
				$result['won_cash'] = $r['won'];
				$result['won_credit'] = $r['credit'];
				$result['l1'] = ($r['l'][1] == LOSE)?false:true;
				$result['l2'] = ($r['l'][2] == LOSE)?false:true;
				$result['l3'] = ($r['l'][3] == LOSE)?false:true;
				$result['l4'] = ($r['l'][4] == LOSE)?false:true;
				$result['l5'] = ($r['l'][5] == LOSE)?false:true;
				$result['s11'] = $r['s'][11];
				$result['s12'] = $r['s'][12];
				$result['s13'] = $r['s'][13];
				$result['s21'] = $r['s'][21];
				$result['s22'] = $r['s'][22];
				$result['s23'] = $r['s'][23];
				$result['s31'] = $r['s'][31];
				$result['s32'] = $r['s'][32];
				$result['s33'] = $r['s'][33];
				if (!empty($r['jackpot']))
				{
					$site = new Site();
					$site->wonJackpot($this->_site['id']);
					$result['jackpot'] = 0;
				}
				else
				{
					$result['jackpot'] = $this->_site['jackpot'];
				}
				$activity = new Activity();
				if ($r['won'] > 0)
				{
					$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.$r['won'], $this->_site['id']);
				}
				
				//TODO: slot game record
				$record = new Record($uid);
				$record->addPlayRecording($r['won'], $r['credit'], $bet, $userinfo['credit'], $userinfo['balance']);
			}
		}
		
		echo json_encode($result);
		exit;
	}
	function actionPoker1()
	{
		$uid = $this->_context->uid;
		$result = array();
		$game = new Game();
		$cu = $this->_app->currentUser();
		$bet = $this->_context->bet;
		if ($bet < 1 || $bet > 5)
		{
			$result['error'] = 1;
			$result['code'] = 10008;
			$result['message'] = Util::getMessage(10008);
		}
		else if ($uid == '0' && $bet == 1)
		{
			do
			{
				$redo = false;
				$c = array();
				$n = array();
				$n[] = '1';
				$n[] = '2';
				$n[] = '3';
				$n[] = '4';
				$n[] = '5';
				$n[] = '6';
				$n[] = '7';
				$n[] = '8';
				$n[] = '9';
				$n[] = 'a';
				$n[] = 'b';
				$n[] = 'c';
				$n[] = 'd';
				$m = array();
				$m[] = 'z';
				$m[] = 'y';
				$m[] = 'x';
				$m[] = 'w';
				shuffle($m);
				shuffle($n);
				$k = array();
				foreach ($n as $nn)
				{
					$k[] = $m[0].$nn;
				}
				$c[] = $k[0];
				$c[] = $k[1];
				$c[] = $k[2];
				$c[] = $k[3];
				$c[] = $k[4];
				$paid = $game->pokerPlay($c[0], $c[1], $c[2], $c[3], $c[4]);
				if ($paid != FLUSH)
				{
					$redo = true;
				}
			}
			while ($redo);
			$result['p1'] = $c[0];
			$result['p2'] = $c[1];
			$result['p3'] = $c[2];
			$result['p4'] = $c[3];
			$result['p5'] = $c[4];
			$_SESSION['PLAYED'] = true;
		}
		else if (empty($uid))
		{
			$result['error'] = 1;
			$result['code'] = 10003;
			$result['message'] = Util::getMessage(10003);
		}
		else if ($cu['id'] != $uid)
		{
			$result['error'] = 1;
			$result['code'] = 10004;
			$result['message'] = Util::getMessage(10004);
		}
		else
		{
			$usermodel = new User();
			$offers = $usermodel->getOffersByUserId($uid);
			$r = $game->pokerPlay1($bet, BASIC_PAYTABLE, $offers);
			$result['p1'] = $r[0];
			$result['p2'] = $r[1];
			$result['p3'] = $r[2];
			$result['p4'] = $r[3];
			$result['p5'] = $r[4];
			$usermodel = new User();
			$usermodel->beforePokerPlay($uid, $bet);
			$userinfo = $usermodel->getUserById($uid);
			$result['credit'] = $userinfo['credit'];
		}
		echo json_encode($result);
		exit;
	}
	
	
	function actionPoker2()
	{
		$uid = $this->_context->uid;
		$bet = $this->_context->bet;
		$p1 = $this->_context->p1;
		$p2 = $this->_context->p2;
		$p3 = $this->_context->p3;
		$p4 = $this->_context->p4;
		$p5 = $this->_context->p5;
		$h1 = $this->_context->h1;
		$h2 = $this->_context->h2;
		$h3 = $this->_context->h3;
		$h4 = $this->_context->h4;
		$h5 = $this->_context->h5;
		$moneysign = strtolower($this->_site['locale']) == 'uk' ? '£' : '$';
		$cu = $this->_app->currentUser();
		$game = new Game();
		if (empty($bet) || empty($p1) || empty($p2) || empty($p3) || empty($p4) || empty($p5) || empty($h1) || empty($h2) || empty($h3) || empty($h4) || empty($h5))
		{
			$result['error'] = 1;
			$result['code'] = 10003;
			$result['message'] = Util::getMessage(10003);
		}
		else if ($bet < 1 || $bet > 5)
		{
			$result['error'] = 1;
			$result['code'] = 10008;
			$result['message'] = Util::getMessage(10008);
		}
		else if ($uid == 0 && $bet == 1)
		{
			$o = array();
			$p = array();
			if ($h1 == 'true')
			{
				$p[0] = $p1;
			}
			if ($h2 == 'true')
			{
				$p[1] = $p2;
			}
			if ($h3 == 'true')
			{
				$p[2] = $p3;
			}
			if ($h4 == 'true')
			{
				$p[3] = $p4;
			}
			if ($h5 == 'true')
			{
				$p[4] = $p5;
			}
			$o[] = $p1;
			$o[] = $p2;
			$o[] = $p3;
			$o[] = $p4;
			$o[] = $p5;
			do
			{
				$redo = false;
				$s = substr($p1, 0, 1);
				$c = $p;
				$n = array();
				$n[] = '2';
				$n[] = '3';
				$n[] = '4';
				$n[] = '5';
				$n[] = '6';
				$n[] = '7';
				$n[] = '8';
				$n[] = '9';
				$n[] = 'a';
				$n[] = 'b';
				$n[] = 'c';
				$n[] = 'd';
				$n[] = '1';
				$k = array();
				foreach ($n as $nn)
				{
					if (!in_array($s.$nn, $o))
					{
						$k[] = $s.$nn;
					}
				}
				shuffle($k);
				if (!isset($c[0]))
				{
					$c[0] = $k[0];
				}
				if (!isset($c[1]))
				{
					$c[1] = $k[1];
				}
				if (!isset($c[2]))
				{
					$c[2] = $k[2];
				}
				if (!isset($c[3]))
				{
					$c[3] = $k[3];
				}
				if (!isset($c[4]))
				{
					$c[4] = $k[4];
				}
				$paid = $game->pokerPlay($c[0], $c[1], $c[2], $c[3], $c[4]);
				if ($paid != FLUSH)
				{
					$redo = true;
				}
			}
			while ($redo);
			$result['p1'] = $c[0];
			$result['p2'] = $c[1];
			$result['p3'] = $c[2];
			$result['p4'] = $c[3];
			$result['p5'] = $c[4];
			$result['won'] = 1;
			$result['cash'] = 1;
			$result['result'] = $paid;
			$result['credit'] = 0;
			$result['jackpot'] = $this->_site['jackpot'];
		}
		else if (empty($uid))
		{
			$result['error'] = 1;
			$result['code'] = 10003;
			$result['message'] = Util::getMessage(10003);
		}
		else if ($cu['id'] != $uid)
		{
			$result['error'] = 1;
			$result['code'] = 10004;
			$result['message'] = Util::getMessage(10004);
		}
		else
		{
			$p = array();
			if ($h1 == 'true')
			{
				$p[0] = $p1;
			}
			if ($h2 == 'true')
			{
				$p[1] = $p2;
			}
			if ($h3 == 'true')
			{
				$p[2] = $p3;
			}
			if ($h4 == 'true')
			{
				$p[3] = $p4;
			}
			if ($h5 == 'true')
			{
				$p[4] = $p5;
			}
			$o = array();
			$o[] = $p1;
			$o[] = $p2;
			$o[] = $p3;
			$o[] = $p4;
			$o[] = $p5;
			$usermodel = new User();
			$offers = $usermodel->getOffersByUserId($uid);
			$r = $game->pokerPlay2($p, $o, $bet, $this->_site['jackpot'], BASIC_PAYTABLE, $offers);
			$result['p1'] = $r['p1'];
			$result['p2'] = $r['p2'];
			$result['p3'] = $r['p3'];
			$result['p4'] = $r['p4'];
			$result['p5'] = $r['p5'];
			$usermodel = new User();
			$usermodel->afterPokerPlay($uid, $r['won']);
			$userinfo = $usermodel->getUserById($uid);
			$result['cash'] = $userinfo['balance'];
			$result['credit'] = $userinfo['credit'];
			$result['won'] = $r['won'];
			$result['result'] = $r['result'];
			if ($r['jackpot'])
			{
				$site = new Site();
				$site->wonJackpot($this->_site['id']);
				$result['jackpot'] = 0;
			}
			else
			{
				$result['jackpot'] = $this->_site['jackpot'];
			}
			if ($r['won'] > 0)
			{
				$activity = new Activity();
				$activity->addActivity($userinfo['firstname'].' '.substr($userinfo['lastname'],0,1), 'Won '.$moneysign.$r['won'], $this->_site['id']);
			}
			
			//TODO: poker game record
			$record = new Record($uid);
			$record->addPlayRecording($r['won'], $r['credit'], $bet, $userinfo['credit'], $userinfo['balance']);
		}
		
		echo json_encode($result);
		exit;
	}
	function actionPoker()
	{
		$c1 = $this->_context->p1;
		$c2 = $this->_context->p2;
		$c3 = $this->_context->p3;
		$c4 = $this->_context->p4;
		$c5 = $this->_context->p5;
		$game = new Game();
		$result = $game->pokerPlay($c1, $c2, $c3, $c4, $c5);
		echo $result;
		exit;
	}
}
?>